<div class="wrap">
  <div id="icon-index" class="icon32"></div>
  <h2><?php e($pageTitle) ?></h2>
  <div id="grid-wrap">
    <table id="memberlist" style="display:none"></table>
  </div>

              <div id="popup" class="abs" style="display:none;">
                <div class="rel">
                  <table id="popup_table" style="width:690px;">
                    <tbody>
                      <tr>
                        <td class="tl"></td>
                        <td class="tm"></td>
                        <td class="tr"></td>
                      </tr>
                      <tr>
                        <td class="ml"></td>
                        <td class="mm">
                          <div id="popup_content">
                            <div class="wrap fLeft"><h2 id="popup-title" style="padding-top:0;"></h2></div>
                            <div id="popup-message"></div>
                            <div id="popup-progress" class="fRight" style="visibility:hidden;"></div>
                            <div class="clear"></div>

                                <div id="registration-wrap" class="popup_content" style="display:none; width:632px;">
                                  <form id="form-registration" action="<?php e($this->base); ?>/admin/members/update" method="post" class="infotxt" onsubmit="return save()">
                                    <div class="fLeft" style="width:300px;">
                                          <table border="0" cellpadding="2" cellspacing="3" width="100%">
                                            <tbody>
                                              <tr>
                                                <td width="133" align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Email'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="email" name="email" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Password'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="password" name="password" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Placement'); ?> :</td>
                                                <td class="infotxt">
                                                  <select id="placement" name="placement" class="select req">
                                                    <option value=""><?php __('select..'); ?></option>
                                                    <option value="A"><?php __('A (Left Side)'); ?></option>
                                                    <option value="B"><?php __('B (Right Side)'); ?></option>
                                                  </select>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td colspan="2"><div style="height:1px; border-top:1px solid #ccc;"></div></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Company Name'); ?> :</td>
                                                <td class="infotxt">
                                                  <input type="text" id="company_name" name="company_name" class="input" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Business Reg No'); ?> :</td>
                                                <td class="infotxt">
                                                  <input type="text" id="company_reg_no" name="company_reg_no" class="input" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Rank'); ?> :</td>
                                                <td class="infotxt">
                                                  <select id="rank_id" name="rank_id" class="select">
                                                    <option value=""><?php __('select..'); ?></option>
<?php foreach ($ranks as $i=>$rank) { ?>
                                                    <option value="<?php e($i); ?>"><?php e($rank); ?></option>
<?php } ?>
                                                  </select>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Account Status'); ?> :</td>
                                                <td class="infotxt">
                                                  <select id="status" name="status" class="select req">
                                                    <option value="M"><?php __('Member'); ?></option>
                                                    <option value="D"><?php __('Distributor'); ?></option>
                                                  </select>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('BV'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="bv" name="bv" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Transfer to Bank'); ?> :</td>
                                                <td class="infotxt">
                                                  <select id="transfer_bank" name="transfer_bank" class="select req" onchange="switchForm()">
                                                    <option value="1"><?php __('Yes'); ?></option>
                                                    <option value="0"><?php __('No'); ?></option>
                                                  </select>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td colspan="2">
                                                  <div id="bank-table">
                                                    <table border="0" cellpadding="0" cellspacing="5" width="100%">
                                                      <tr>
                                                        <td width="133" align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Bank'); ?> :</td>
                                                        <td class="infotxt">
                                                          <select id="bank" name="bank" class="select req2">
                                                            <option value="">select..</option>
                                                            <option>OCBC Bank</option>
                                                            <option>Affin Bank</option>
                                                            <option>Alliance Bank</option>
                                                            <option>AmBank</option>
                                                            <option>Bank Islam Malaysia</option>
                                                            <option>Bank Kerjasama Rakyat M'sia</option>
                                                            <option>Bank Muamalat</option>
                                                            <option>Bank Simpanan Nasional</option>
                                                            <option>CIMB Bank</option>
                                                            <option>Citibank</option>
                                                            <option>Deutsche Bank Berhad</option>
                                                            <option>EON Bank</option>
                                                            <option>Hong Leong Bank</option>
                                                            <option>HSBC Bank</option>
                                                            <option>Maybank</option>
                                                            <option>Public Bank</option>
                                                            <option>RHB Bank</option>
                                                            <option>Standard Chartered Bank</option>
                                                            <option>The Royal Bank of Scotland</option>
                                                            <option>United Overseas Bank</option>
                                                            <option>Bank of America</option>
                                                          </select>
                                                        </td>
                                                      </tr>
                                                      <tr>
                                                        <td align="right" class="infotxt">&nbsp;<?php __('Branch'); ?> :</td>
                                                        <td class="infotxt"><input type="text" id="branch" name="branch" class="input" /></td>
                                                      </tr>
                                                      <tr>
                                                        <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Bank Account No'); ?> :</td>
                                                        <td class="infotxt"><input type="text" id="bank_account" name="bank_account" class="input req2" /></td>
                                                      </tr>
                                                    </table>
                                                  </div>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Receiver Name'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="receiver_name" name="receiver_name" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Receiver Telephone'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="receiver_telephone" name="receiver_telephone" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:6px;"><span class="style16">*</span>&nbsp;<?php __('Join On'); ?> :</td>
                                                <td class="infotxt">
                                                  <input type="hidden" id="join_date" name="join_date" />
                                                  <input type="text" id="join-date" value="select.." readonly="readonly" class="date req" />
                                                  <input type="text" id="join_time" name="join_time" class="input time req" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:6px;"><?php __('Renew Date'); ?> :</td>
                                                <td class="infotxt">
                                                  <input type="hidden" id="renew_date" name="renew_date" />
                                                  <input type="text" id="renew-date" value="select.." readonly="readonly" class="date" />
                                                  <input type="text" id="renew_time" name="renew_time" class="input time req" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td colspan="2" class="infotxt"><span class="style16">*</span>&nbsp;<b><?php __('Required Field'); ?></b></td>
                                              </tr>
                                            </tbody>
                                          </table>
                                    </div>
                                    <div class="fRight" style="width:302px; margin-left:30px;">
                                          <table border="0" cellpadding="2" cellspacing="3" width="100%">
                                            <tbody>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Upline'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="member_id" name="member_id" class="input" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Actual Upline'); ?> :</td>
                                                <td class="infotxt">
                                                  <select id="upline_leg" name="upline_leg" class="select req">
                                                    <option value=""><?php __('select..'); ?></option>
                                                    <option value="A"><?php __('A (Left Side)'); ?></option>
                                                    <option value="B"><?php __('B (Right Side)'); ?></option>
                                                  </select>
                                                  <input type="text" name="reserved_id" class="input" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Sponsor'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="sponsor_id" name="sponsor_id" class="input" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;</td>
                                                <td class="infotxt" style="height:27px;">&nbsp;</td>
                                              </tr>
                                              <tr>
                                                <td colspan="2"><div style="height:1px; border-top:1px solid #ccc;"></div></td>
                                              </tr>
                                              <tr>
                                                <td width="138" align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Full Name'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="fullname" name="fullname" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Date of Birth'); ?> :</td>
                                                <td class="infotxt">
                                                  <input type="hidden" id="dob" name="dob" />
                                                  <input type="text" id="dob-date" value="select.." readonly="readonly" class="date req" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('ID / Passport No'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="identity" name="identity" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:6px;"><span class="style16">*</span>&nbsp;<?php __('Residential Address'); ?> :</td>
                                                <td class="infotxt">
                                                  <textarea id="residential_address" name="residential_address" class="input req"></textarea>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Residential Postcode'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="residential_postcode" name="residential_postcode" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:6px;"><span class="style16">*</span>&nbsp;<?php __('Postal Address'); ?> :</td>
                                                <td class="infotxt">
                                                  <textarea id="postal_address" name="postal_address" class="input req"></textarea>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Postal Postcode'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="postal_postcode" name="postal_postcode" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Country'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="country" name="country" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">&nbsp;<?php __('Telephone'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="telephone" name="telephone" class="input" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;<?php __('Mobile No'); ?> :</td>
                                                <td class="infotxt"><input type="text" id="mobile" name="mobile" class="input req" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:6px;">&nbsp;<?php __('Remarks'); ?> :</td>
                                                <td class="infotxt">
                                                  <textarea id="remark" name="remark" class="input" style="height:62px;"></textarea>
                                                </td>
                                              </tr>
                                            </tbody>
                                          </table>
                                    </div>
                                    <div class="clear"></div>
                                    <div class="center popupActions rel">
                                      <input type="hidden" id="id" name="id" value="" />
                                      <input type="submit" value="Save" />
                                      <input type="button" value="Cancel" onclick="closePopup();" />
                                      <div id="print" class="abs" style="display:none; top:3px; right:0;" onclick="printMember()"><?php __('print'); ?></div>
                                    </div>
                                  </form>
                                </div>

                                <div id="cashInOut-wrap" class="popup_content" style="display:none;">
                                    <div class="fLeft" style="width:380px;">
                                        <form id="form-cashInOut" action="<?php e($this->base); ?>/admin/funds/cashInOut" method="post" class="infotxt" onsubmit="return saveCash()">
                                          <table border="0" cellpadding="2" cellspacing="3" width="100%">
                                            <tbody>
                                              <tr>
                                                <td align="right" class="infotxt">Member Id :</td>
                                                <td class="infotxt"><span id="cash-id" class="infotxt">&nbsp;</span></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">Name :</td>
                                                <td class="infotxt"><span id="cash-name" class="infotxt">&nbsp;</span></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">Current Cash :</td>
                                                <td class="infotxt">
                                                  <input type="hidden" id="cash_cash" />
                                                  USD <span id="cash-cash" class="infotxt">&nbsp;</span>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt"><span class="style16">*</span>&nbsp;Date :</td>
                                                <td class="infotxt">
                                                  <input type="hidden" id="trans_date" name="trans_date" />
                                                  <input type="text" id="trans-date" value="select.." readonly="readonly" class="date req" />
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:5px;"><span class="style16">*</span>&nbsp;Add / Deduct :</td>
                                                <td class="infotxt">
                                                  <input type="text" id="add_deduct" name="add_deduct" class="input req" autocomplete="off" onkeyup="calculateBalance()" />
                                                  <div style="color:#777;">put "<span style="color:red;">-</span>" negative sign for deduction</div>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td align="right" valign="top" class="infotxt" style="padding-top:5px;">Remark :</td>
                                                <td class="infotxt"><input type="text" id="cash_remark" name="cash_remark" class="input" /></td>
                                              </tr>
                                              <tr>
                                                <td align="right" class="infotxt">New Cash Balance :</td>
                                                <td class="infotxt">USD <span id="cash-newBalance" class="infotxt">&nbsp;</span></td>
                                              </tr>
                                              <tr>
                                                <td colspan="2" class="infotxt" style="color:#777;">
                                                  <span class="style16">*</span>&nbsp;Please note that actual cash may varies as member may do transaction during the period of updating.
                                                </td>
                                              </tr>
                                            </tbody>
                                          </table>
                                          <div class="center popupActions">
                                            <input type="hidden" id="cash_id" name="cash_id" value="" />
                                            <input type="submit" value="Save" />
                                            <input type="button" value="Cancel" onclick="closePopup();" />
                                            <input type="button" id="toggle-history" value="Show History >>" style="margin-left:20px;" onclick="toggleHistory();" />
                                          </div>
                                        </form>
                                    </div>
                                    <div id="cash-history" class="fRight" style="width:545px; display:none;">
                                      <div id="cash-history-header">
                                        <div class="fLeft bold right" style="width:50px;">Id</div>
                                        <div class="fLeft bold center" style="width:100px;">Date</div>
                                        <div class="fLeft bold right" style="width:70px;">Deposit</div>
                                        <div class="fLeft bold right" style="width:90px;">Withdrawal</div>
                                        <div class="fLeft bold" style="width:138px; margin-left:18px;">Remark</div>
                                        <div class="fLeft bold center" style="width:45px;">Delete</div>
                                        <div class="clear"></div>
                                      </div>
                                      <div id="cash-history-body" style="overflow:auto; width:550px; height:256px;">
                                        <div id="trans_{id}" class="row">
                                          <div class="fLeft right" style="width:50px;">{id}</div>
                                          <div class="fLeft center" style="width:100px;">{date}</div>
                                          <div class="fLeft right" style="width:70px; color:#0517B9;">{cash_in}</div>
                                          <div class="fLeft right" style="width:90px; color:#C81111;">{cash_out}</div>
                                          <div class="fLeft" style="width:138px; margin-left:18px;">{remark}</div>
                                          <div class="fLeft center" style="width:45px;"><div class="delete" onclick="deleteTransaction('{id}');"> </div></div>
                                          <div class="clear"><input type="hidden" id="bank_{id}" value="{bank}" /></div>
                                        </div>
                                      </div>
                                      <div id="cash-history-footer">
                                        <div class="fLeft right" style="width:150px; font-weight:bold;">Total:</div>
                                        <div id="total-deposit" class="fLeft right" style="width:70px; color:#0517B9;">0.00</div>
                                        <div id="total-withdraw" class="fLeft right" style="width:90px; color:#C81111;">0.00</div>
                                        <div class="fLeft" style="width:138px; margin-left:63px;"> </div>
                                        <div class="clear">
                                          <input type="hidden" id="total-deposit-hide" value="0" />
                                          <input type="hidden" id="total-withdraw-hide" value="0" />
                                        </div>
                                      </div>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                          </div>
                        </td>
                        <td class="mr"></td>
                      </tr>
                      <tr>
                        <td class="bl"></td>
                        <td class="bm"></td>
                        <td class="br"></td>
                      </tr>
                    </tbody>
                  </table>
                  <div title="Close" id="popup_close" onclick="closePopup();"></div>
                </div>
              </div>
</div>

<script>
var _webroot   = '<?php e($this->base); ?>';
var _countries = ['<?php echo @implode("', '", $countries); ?>'];
<?php $this->addScript('Ext.onReady(function() { init(); });'); ?>
</script>